package com.reggie.interceptor;

import com.reggie.common.BaseContext;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class loginFrontInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Long user = (Long) request.getSession().getAttribute("user");
        System.out.println(user);
        BaseContext.set(user);
        return user != null;
    }
}
